﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>消息推送 </title>
    <script type="text/javascript">
        //删除.
        function Del(mypk, nodeid) {
            if (mypk == '') {
                alert("默认发送不允许删除，您可以修改。");
                return;
            }
            if (window.confirm('您确定要删除吗?') == false)
                return;
            window.location.href = 'PushMessage.htm?MyPK=' + mypk + '&DoType=Del&FK_Node=' + nodeid;
        }
    </script>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../Comm/Gener.js"></script>
    <base target="_self" />
    <script src="../Admin.js"></script>
    <style>
        #Btn_New, #Btn_Help {
            border: 1px solid #031f5d;
            background-color: #fff;
            color: #031f5d;
            background-repeat:no-repeat;
            background-size: 13px 13px !important;
            background-position: 1px 6px !important;
        }

        #Btn_New {
            background-image: url(../../Img/Btn/New.png) !important;
        }

        #Btn_Help {
            background-image: url(../../Img/Btn/Help.png) !important;
        }
    </style>
    <script type="text/javascript">
        function Esc() {
            if (event.keyCode == 27)
                window.close();
            return true;
        }

        /*隐藏与显示.*/
        function ShowHidden(ctrlID) {

            var ctrl = document.getElementById(ctrlID);
            if (ctrl.style.display == "block") {
                ctrl.style.display = 'none';
            } else {
                ctrl.style.display = 'block';
            }
        }
    </script>
    <script type="text/javascript" language="javascript">
        //页面启动函数.
        $(function () {

            var ens = new Entities("BP.WF.Template.PushMsgs");
            ens.Retrieve("FK_Node", GetQueryString("FK_Node"));

            for (var i = 0; i < ens.length; i++) {
                var emailCheck = "";
                var ccmsg = ""
                var sms = "";
                var dingding = "";
                var weixin = "";
                var tm = "";
                var en = new Entity("BP.WF.Template.PushMsg", ens[i].MyPK);

                var newRow = "";
                newRow = "<tr ><td class=Idx>" + (i + 1) + "</td>";
                newRow += "<td><a href='PushMessageEntity.htm?&FK_Event=" + en.FK_Event + "&MyPK=" + en.MyPK + "&FK_Node=" + en.FK_Node + "'>" + en.FK_Event + "</a></td>";
                newRow += "<td>" + PushWayText(en.FK_Event, en.SMSPushWay) + "</td>";
                newRow += "<td>"
                //发送形式
                var pushModel = en.SMSPushModel;

                if (pushModel.indexOf('Email') != -1)
                    emailCheck = "checked=checked"
                if (pushModel.indexOf('CCMsg') != -1)
                    ccmsg = "checked=checked"
                if (pushModel.indexOf('SMS') != -1)
                    sms = "checked=checked"
                if (pushModel.indexOf('DingDing') != -1)
                    dingding = "checked=checked"
                if (pushModel.indexOf('WeiXin') != -1)
                    weixin = "checked=checked"
                if (pushModel.indexOf('WS') != -1)
                    tm = "checked=checked"
                newRow += "<label><input id='CB_SMSPushModel_Email' type='checkbox' name='CB_SMSPushModel' value='Email' disabled " + emailCheck + "/>邮件</label>";
                newRow += "<label><input id='CB_SMSPushModel_CCMsg' type='checkbox' name='CB_SMSPushModel' value='CCMsg' disabled  " + ccmsg + "/>站内消息</label>";
                newRow += "<label><input id='CB_SMSPushModel_SMS' type='checkbox' name='CB_SMSPushModel' value='SMS' disabled " + sms + "/>短信</label>";
                newRow += "<label><input id='CB_SMSPushModel_DingDing' type='checkbox' name='CB_SMSPushModel' value='DingDing' disabled " + dingding + "/>钉钉</label>";
                newRow += "<label><input id='CB_SMSPushModel_WeiXin' type='checkbox' name='CB_SMSPushModel' value='WeiXin' disabled " + weixin + "/>微信</label>";
                newRow += "<label><input id='CB_SMSPushModel_WS' type='checkbox' name='CB_SMSPushModel' value='WS' disabled " + tm + "/>WebServices</label>";
                newRow += "</td>";
                newRow += "<td><a href=\"javascript:Delete('" + en.MyPK + "')\"><img src='../../../WF/Img/Btn/Delete.gif' border=0 />删除</a>";
                newRow += "</td>";
                newRow += "</tr>";

                $("#Table1 tr:last").after(newRow);
            }
        });


        function PushWayText(EventListNode, PushWay) {

            var ret = {
                "WorkArrive": ["不发送", "发送给当前节点的所有处理人", "向指定的字段发送", "其他节点的处理人", "按照SQL计算", "发给指定的人"],
                "SendSuccess": ["不发送", "发送给下一个节点的所有接受人", "向指定的字段发送", "其他节点的处理人", "按照SQL计算", "发给指定的人"],
                "ReturnAfter": ["不发送", "发送给被退回的节点处理人", "向指定的字段发送", "其他节点的处理人", "按照SQL计算", "发给指定的人"],
                "UndoneAfter": ["不发送", "撤销工作后通知的节点接受人", "向指定的字段发送", "其他节点的处理人", "按照SQL计算", "发给指定的人"],
                "ShitAfter": ["不发送", "发送给被移交的节点接受人", "向指定的字段发送", "其他节点的处理人", "按照SQL计算", "发给指定的人"],
                "CCAfter": ["不发送", "发送给被抄送的人", "向指定的字段发送", "其他节点的处理人", "按照SQL计算", "发给指定的人"],
                "PressAfter": ["不发送", "发送给被催办的人", "向指定的字段发送", "其他节点的处理人", "按照SQL计算", "发给指定的人"],
                "FlowOverAfter": ["不发送", "流程结束通知的所有流程的参与人", "向指定的字段发送", "其他节点的处理人", "按照SQL计算", "发给指定的人"],
                "AfterFlowDel": ["不发送", "流程删除后通知所有流程的参与人", "向指定的字段发送", "其他节点的处理人", "按照SQL计算", "发给指定的人"],
                "NodeWarning": ["不发送", "发送给当前节点的所有处理人", "向指定的字段发送", "其他节点的处理人", "按照SQL计算", "发给指定的人"],
                "NodeOverDue": ["不发送", "发送给当前节点的所有处理人", "向指定的字段发送", "其他节点的处理人", "按照SQL计算", "发给指定的人"]
            };

            return ret[EventListNode][PushWay];
        }

        function Delete(myPK) {

            if (window.confirm('您确定要删除吗？') == false)
                return;
            var en = new Entity("BP.WF.Template.PushMsg");
            en.MyPK = myPK;
            en.Delete();
            window.location.href = window.location.href;
        }

        function PushMessageEntity(eventType) {

            var url = 'PushMessageEntity.htm?FK_Node=' + GetQueryString('FK_Node');
            url += '&FK_Flow=' + GetQueryString('FK_Flow');
            url += '&FK_Event=' + eventType;
            url += '&tk=' + Math.random();

            window.location.href = url;
        }
        function Help() {
            var url = "http://ccbpm.mydoc.io";
            window.open(url);
        }

    </script>

</head>
<body onkeypress="Esc();" style="font-size: smaller">
    <form method="post" action="./PushMessage.htm?FK_Node=102&amp;FK_Flow=001&amp;tk=0.047329046785519&amp;s=0.3961371863054315"
          id="form1">
        <div style="right:30px; position:absolute; z-index:100; ">
            <fieldset style="border: 0px;">
                <input type="button" value="新建消息" id="Btn_New" onclick="ShowHidden('state')" />&nbsp;&nbsp;
                <div id="state" style="width:200px;height:auto; position:absolute; z-index:10;background-color:white; border:1px outset black; display: none; color: Gray">
                    <ul>
                        <li><a href="javascript:PushMessageEntity('WorkArrive');">工作到达</a> </li>
                        <li><a href="javascript:PushMessageEntity('SendSuccess');">节点发送成功时</a> </li>
                        <li><a href="javascript:PushMessageEntity('ReturnAfter');">当节点退回后</a> </li>
                        <li><a href="javascript:PushMessageEntity('UndoneAfter');">当节点撤销发送后</a> </li>
                        <li><a href="javascript:PushMessageEntity('ShitAfter');">当节点移交后</a> </li>
                        <li><a href="javascript:PushMessageEntity('CCAfter');">节点抄送后</a> </li>
                        <li><a href="javascript:PushMessageEntity('PressAfter');">节点催办后</a> </li>
                        <li><a href="javascript:PushMessageEntity('FlowOverAfter');">流程结束后</a> </li>
                        <li><a href="javascript:PushMessageEntity('AfterFlowDel');">流程删除后</a> </li>
                        <li><a href="javascript:PushMessageEntity('NodeWarning');">节点预警处理</a> </li>
                        <li><a href="javascript:PushMessageEntity('NodeOverDue');">节点逾期处理</a> </li>
                    </ul>
                </div>
                <input id="Btn_Help" type="button" value="帮助" onclick="Help()" />
            </fieldset>
        </div>
        <div style="position:relative;top:10px; margin: 8px">
            <table id="Table1" style="width: 100%">
                <caption><img style="margin-bottom:8px;" align="middle" src='../../Img/Event.png' />
                    消息事件
                </caption>

                <tr>
                    <th>
                        序
                    </th>
                    <th>
                        消息发生事件
                    </th>
                    <th>
                        消息接收规则
                    </th>
                    <th>
                        发送形式
                    </th>
                    <th>
                        操作
                    </th>
                </tr>
            </table>
            
        </div>
    </form>
</body>
</html>
